<?php

$CLFetchers->fetchLstDataHeader($Db,
                                $jobId,
                                $SourceDb,
                                $nHeader,
                                $lstHeader);

$_POST["trDateEnt"]     = date("d-m-Y",
                               strtotime($lstHeader["TR_DATE"][0]));

$_POST["whsEnt"]   = $lstHeader["WAREHOUSE"][0];
$_POST["modelEnt"] = $lstHeader["MODEL"][0];
$_POST["qtyEnt"]   = $lstHeader["QTY"][0];
$_POST["memoEnt"]  = $lstHeader["MEMO"][0];

$CFetchers->fetchLstDataDetail($Db,
                               $jobId,
                               $SourceDb->fetchValue("srcDbDtl"),
                               $nDetail,
                               $lstDetail);

for($iRow = 0; $iRow < $nDetail; $iRow++){

  $_POST["priceEnt"][$iRow]  = $lstDetail["PRICE"][$iRow];
  $_POST["headEnt"][$iRow]   = $lstDetail["HEAD"][$iRow];
  $_POST["lengthEnt"][$iRow] = $lstDetail["LENGTH"][$iRow];
  $_POST["serNumEnt"][$iRow] = $lstDetail["SER_NUM"][$iRow];
}

echo  "<link rel=\"stylesheet\" type=\"text/css\" href=\"../myMenu.css\"/>\n".

      /**
      * Since this is to prevent default 'enter'
      *
      */
      "<body >\n".
      "<form  name='initMe' action=entry.php method=post>\n".

      /**
      * Global header
      *
      */
      "<table border='1' class='dedeq' >\n".
      "<tr>\n".

      "<th> DATE </th><td > ".$_POST["trDateEnt"]." </td> \n".

      "</tr>\n".
      "<tr>\n".

      "<th> Warehouse </th><td> ".$_POST["whsEnt"]." </td>\n".

      "</tr>\n".
      "<tr>\n".

      "<th> Model     </th><td> ".$_POST["modelEnt"]." </td>\n".

      "</tr>\n".
      "</tr>\n".

        "<th> Qty     </th><td> ".$_POST["qtyEnt"]." </td>\n".

      "</tr>\n".
      "</tr>\n".

        "<th> Memo    </th><td> ".$GHtml->formTextArea("memoEnt",
                                                       $_POST["memoEnt"],
                                                       _MODE_READONLY)." </td>\n".

      "</tr>\n".
      "</table><br/>\n".

      "<table border='1' class='dedeq'>\n".
      "<tr>\n".
      "<th> No </th>\n".
      "<th> Price </th>\n".
      "<th> SN </th>\n".
      "</tr>\n";

for($iRow = 0; $iRow < $nDetail; $iRow++){

  echo  "<tr>\n".

          "<td> ".($iRow + 1)." </td>\n".

          "<td> ".$_POST["priceEnt"][$iRow]." </td>\n".

          "<td> <table border='1' class='dedeq'>

                <td> ".$_POST["headEnt"][$iRow]."    </td>

                <td> ".$_POST["lengthEnt"][$iRow]."  </td>

                <td> ".$_POST["serNumEnt"][$iRow]."  </td>

                </table>
                </td>\n".

        "</tr>\n";
}

echo  "</table><br/>\n";


?>